I am trying to create a script that can be run from the DOORS project level that would loop through all the modules, then for each module it would create in-link columns, a separate column per linked module. I can easily create these columns using the Analysis Wizard and make a column for each specific linked module, but this what I'm trying to automate.
My script currently loops through all the modules I need and loads the linked modules as needed. Through the DXL debug window I can print each of the linked objects (all the in-links and out-links), but I cannot figure out how to insert the text into the blank columns that I inserted.
Here's the function that gets the link info, called from the main function:
void getLinkInfo( Module m )
{
Object o
Link l
ModName_ srcModName
Module thisMod
string lnkModName
string modName
ModuleVersion otherVersion = null
Object othero
Skip skpLnkModList = createString
string toDisplay
for o in m do {
toDisplay = ""
//means to pre-load modules
for srcModName in o <- "*" do {
lnkModName = fullName(srcModName) ""
if ( !find(skpLnkModList,lnkModName) )
{
thisMod = quickOpenMod(lnkModName)
put(skpLnkModList,lnkModName,thisMod)
}
}
//loop through in-links
for l in o <- "*" do {
srcModName = source l
lnkModName = fullName(srcModName) ""
othero = source l
modName = name(srcModName)
if (null othero) continue
if (modName == "Linked Module 1") {
if (toDisplay == "") toDisplay = othero."Object Heading" ""
else toDisplay = toDisplay "\n" othero."Object Heading" ""
}
}
print("This is the value: " toDisplay "\n")
}
}
The print call gets me what I want but I can't figure out how to input it. I read that I need to use a DXL layout or use the dxl() method, but no matter where I place 'display' calls or merge the Analysis Wizard generated code into mine, it just doesn't work. Thanks for any help in advance! xwind2 - Wed Jul 06 17:44:46 EDT 2016 |
Re: Analysis Wizard manual implementation The function that you have created loops through the whole module. You need to break it down to the object (second loop within your function) that loops through the links. Then you need to use the "display" instead the print, and use the obj doors defined variable to get the data for the individual object. Then put that in the layout dxl column and save the view.
For example something like this
void getLinkInfo( Object o )
{
Link l
ModName_ srcModName
Module thisMod
string lnkModName
string modName
ModuleVersion otherVersion = null
Object othero
string toDisplay = ""
//means to pre-load modules
for srcModName in o <- "*" do {
if(!open(srcModName)) {
thisMod = quickOpenMod(fullName(srcModName))
}
}
//loop through in-links
for l in o <- "*" do {
srcModName = source l
lnkModName = fullName(srcModName)
othero = source l
modName = name(srcModName)
if (null othero) continue
if (modName == "Linked Module 1") {
if (toDisplay == "") toDisplay = othero."Object Heading" ""
else toDisplay = toDisplay "\n" othero."Object Heading" ""
}
}
display("This is the value: " toDisplay
}
getLinkInfo(obj)
Then enter the code in a dxl column. |